<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<h1>欢迎你！！！</h1>
<input type="button" value="testAjax" onclick="testAjax()"/>
<script type="text/javascript" src="<%=basePath%>resources/scripts/jquery-1.11.2.js"></script>
<script type="text/javascript">
var basepath = '<%=basePath%>';
//alert(basepath);
function testAjax(){
	$.ajax({
		url: basepath+"main/testAjax.do",
		dataType: 'json',
		type: 'POST',
		data: {},
		success: function(msg){
		     alert( "Say: " + msg.flag );
		   }

	});
}
</script>

<a href="<%=basePath%>file/download.do?fileName=测试.txt">点我下载</a>
</body>
</html>